-- print ("load options.lua")

-- This file is automatically loaded by plugins.core
vim.g.mapleader = " "			-- the leader-key
vim.g.maplocalleader = " "		-- the local leader-key

local opt = vim.opt
-- opt.winbar = "%=%m %f
opt.termguicolors = true
opt.autowrite = true 			-- Enable autowrite
opt.clipboard = { "unnamedplus", "unnamed" } 		-- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect"
opt.conceallevel = 2 			-- Hide * markup for bold and italic, but not markers with substitutions
opt.confirm = false 			-- Confirm to save changes before exiting modified buffer
opt.cursorline = true 			-- Enable highlighting of the current line
opt.expandtab = false 			-- Use spaces instead of tabs
-- opt.formatoptions = "jcroqlnt" 	-- tcqj
opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep"
opt.ignorecase = true 			-- Ignore case
opt.inccommand = "nosplit" 		-- preview incremental substitute
opt.laststatus = 3 			-- global statusline
opt.list = false 			-- Show some invisible characters (tabs...
opt.mouse = "a" 			-- Enable mouse mode
opt.mousemoveevent = true
opt.number = true 			-- Print line number
-- opt.pumblend = 100 			-- Popup blend
opt.pumheight = 10 			-- Maximum number of entries in a popup
opt.relativenumber = false 		-- Relative line numbers
-- opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
opt.shiftround = true 			-- Round indent
opt.shiftwidth = 4 			-- Size of an indent
opt.shortmess:append({ W = true, I = true, c = true, C = true })
opt.showmode = true 			-- show the editor mode
opt.sidescrolloff = 8 			-- Where to scroll the text
opt.signcolumn = "yes" 			-- Always show the signcolumn, otherwise it would shift the text each time
opt.smartcase = true 			-- Don't ignore case with capitals
opt.smartindent = true 			-- Insert indents automatically
opt.spell = false 			-- Disable the spell check
opt.spelllang = { "en", "cjk" }
opt.splitbelow = true 			-- Put new windows below current
opt.splitkeep = "screen"
opt.splitright = true 			-- Put new windows right of current
opt.tabstop = 4 			-- Number of spaces tabs count for
opt.termguicolors = true 		-- True color support
opt.timeoutlen = 300 			-- the timeout len of pressing two keys
opt.undofile = true
opt.undolevels = 10000
opt.updatetime = 200 			-- Save swap file and trigger CursorHold
opt.virtualedit = "block" 		-- Allow cursor to move where there is no text in visual block mode
opt.wildmode = "longest:full,full" 	-- Command-line completion mode
opt.winminwidth = 5 			-- Minimum window width
opt.wrap = false			-- the config of line wrap

opt.fillchars = {
  foldopen = "",
  foldclose = "",
  -- fold = "⸱",
  fold = " ",
  foldsep = " ",
  diff = "╱",
  eob = " ",
}

if vim.fn.has("nvim-0.10") == 1 then
  opt.smoothscroll = true
end

-- Folding
vim.opt.foldlevel = 99
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"

-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
if vim.fn.has("nvim-0.10") == 1 then
  vim.opt.foldmethod = "expr"
  vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
else
  vim.opt.foldmethod = "indent"
end

vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()"


-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0
